package com.qf.wangqing.sportsnews;

import android.app.Application;
import android.os.StrictMode;

import com.qf.wangqing.sportsnews.callback.CompetitionService;
import com.qf.wangqing.sportsnews.callback.NewsServive;
import com.qf.wangqing.sportsnews.callback.SlidingService;
import com.qf.wangqing.sportsnews.callback.headline.HeadNetService;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by wuyang on 2016/12/15.
 */

public class MyApplication extends Application{
    private CompetitionService competitionService;
    private NewsServive newsChannelServive;
    public CompetitionService getCompetitionService(){
        return competitionService;
    }
    private NewsServive newsService;
    private HeadNetService headNetService;

    public NewsServive getNewsService() {
        return newsService;
    }

    private SlidingService slidingService;

    public NewsServive getNewsChannelServive() {
        return newsChannelServive;
    }

    public SlidingService getSlidingService() {
        return slidingService;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyLog()
                .penaltyDeath()
                .build()
        );
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .penaltyDeath()
                .build()
        );







        newsService = new Retrofit.Builder()
                .baseUrl("http://www.baidu")
                .addConverterFactory(GsonConverterFactory.create())
                .build()
                .create(NewsServive.class);
        competitionService=new Retrofit.Builder()
                .baseUrl("http://www.baidu")
                .addConverterFactory(GsonConverterFactory.create())
                .build()
                .create(CompetitionService.class);

        headNetService=new Retrofit.Builder()
                .baseUrl("http://www.baidu.com")
                .addConverterFactory(GsonConverterFactory.create())
                .build()
                .create(HeadNetService.class);

        slidingService = new Retrofit.Builder()
                 .baseUrl("http://www.baidu")
                .addConverterFactory(GsonConverterFactory.create())
                .build()
                .create(SlidingService.class);


    }
    public HeadNetService getHeadNetService(){
        return headNetService;
    }
}
